﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilZ.Dotnet.Ex.Communication.Net.MQBase
{
    /// <summary>
    /// MQ文本消息
    /// </summary>
    public class MQTextMessage : MQMessageAbs
    {
        private string _content = null;
        /// <summary>
        /// 消息内容
        /// </summary>
        public string Content
        {
            get { return _content; }
            set { _content = value; }
        }

        /// <summary>
        /// 消息体
        /// </summary>
        public override object Body
        {
            get { return _content; }
            set { _content = (string)value; }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public MQTextMessage()
            : base(MQMessageType.Text)
        {

        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="content">消息内容</param>
        public MQTextMessage(string content)
            : this()
        {
            this._content = content;
        }


        /// <summary>
        /// 重写ToString
        /// </summary>
        /// <returns>String</returns>
        public override string ToString()
        {
            return this._content;
        }
    }
}
